home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / script / nopaste < prev    next >
Encoding:
Text File  |  2002-10-28  |  753 b   |  50 lines

  1. load utime
  2.  
  3. on ^set "nopaste on" {
  4.     @ nopaste.on = 1
  5.     setup_nopaste
  6.     xecho -b NOPASTE set to on
  7. }
  8.  
  9. on ^set "nopaste off" {
  10.     @ nopaste.on = 0
  11.     remove_nopaste
  12.     xecho -b NOPASTE set to off
  13. }
  14.  
  15. alias setup_nopaste 
  16. {
  17.     @ nopaste.last = utime()
  18.     @ nopaste.counter = 0
  19.     on ?input * {
  20.         if ([$[1]*] == [/]) {
  21.             return 0
  22.         }
  23.         if ((:nc = strlen($*)) == 0) {
  24.             return 0
  25.         }
  26.         @ :td = utime_sub($utime() $nopaste.last)
  27.         @ :sec = word(0 $td)
  28.         @ :usec = (sec * 1000000) + word(1 $td)
  29.         @ nopaste.last = utime()
  30.  
  31.         @ :us = ((100000 - usec) / nc)
  32.         @ nopaste.counter += us
  33.         if (nopaste.counter < 0) {
  34.             @ nopaste.counter = 0
  35.         }
  36.         if (nopaste.counter > 2500) {
  37.             parsekey erase_line
  38.             return 1
  39.         } {
  40.             return 0
  41.         }
  42.     }
  43. }
  44.  
  45. alias remove_nopaste
  46. {
  47.     on input -*
  48. }
  49.  
  50.